<%-- 
    Document   : HomePage
    Created on : 19-05-2011, 21:26:25
    Author     : ngloc_it
--%>

<%@page import="java.util.ArrayList"%>
<%@page import="uit.jee.lib.dto.CommentDTO"%>
<%@page import="uit.jee.lib.dto.BookDTO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%
    BookDTO book = (BookDTO) session.getAttribute("book");
    ArrayList<CommentDTO> comments = (ArrayList<CommentDTO>) session.getAttribute("comments");

    int nComment = 0;
    if(comments != null){
        nComment = comments.size();
    }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script language="javascript" type="text/javascript" src="../js/javascriptfile.js"></script>
        <link rel="stylesheet" type="text/css" href="../css/style.css">

        <%--<script language="javascript" type="text/javascript" src="../js/Common.js"></script>--%>
        <title>Trang chủ</title>
    </head>
    <body>
  <div id="wrapper">
      <%@include file ="./subpage/menu.jsp" %>
      <%@include file ="./subpage/header.jsp" %>
      <div class="divider"></div>
     <%@include file ="./subpage/searchbar.jsp" %>
      
     <div id="orangerow">

         <%@include file="./subpage/navOrange.jsp" %>

         <%if (book != null) {%>
         <div class="col">
             <div id="bookmonth">
                 <div 
                     id="bookmonth_imaged"><img src="..<%=book.getImgPath()%>" width="185" height="98"
                                            alt="explore your knowledge" />
                 </div>
                 <div id="bookmonth_title">
                     <b>
                         <H2><%=book.getName()%></H2>
                     </b>
                 </div>
                 <div id="bookmonth_author">
                     Tác giả:
                     <b><a href="#"><%=book.getAuthor()%></a></b>
                 </div>
                 <div id="bookmonth_type">
                     Loại sách:<b><a href="abc.jsp"><%=book.getBookType()%></a></b>
                 </div>
                 <div id="bookmonth_publisher">
                     Nhà xuất bản:<b><%=book.getPublisher()%></b>
                 </div>
                 <div id="bookmonth_publisher_date">
                     Ngày xuất bản: <b><%=book.getPublisDate()%></b>
                 </div>
                 <div id="bookmonth_status">
                     Tình trạng: <b>
                         <%
                         String status = "";
                         switch(book.getStatus()){
                             case BookDTO.BOOK_TATUS_FREE:
                                 status = "Chưa mượn";
                                 break;
                             case BookDTO.BOOK_TATUS_ORDER:
                                 status = "Đã đặt";
                                 break;
                             case BookDTO.BOOK_TATUS_UN_FREE:
                                status = "Đã mượn";
                                 break;
                         }
                         %>
                         <%=status%>
                     </b></div>
                 <div id="bookmonth_counter">
                     Số lần mượn:<b><%=book.getCounter()%></b>
                 </div>
                 <div id="bookmonth_content">
                     <i>
                         <%=book.getMainContent()%>
                     </i>
                 </div>
             </div><!-- end bookmonth -->

             <div id="comment">
                 <br/><br/><br/><br/>
                 <%for(int i = 0; i < nComment; i++){%>
                    <p>
                        <%=comments.get(i).getContents()%>
                        <br/>
                        <%=comments.get(i).getReaderName()%>
                        <br/>
                        <%=comments.get(i).getDate()%>
                        <br/>
                    </p>
                    <hr/><hr/>
                 <%}%>
             </div>
         </div><!-- end .col -->
         <%}%>
         <div id="whitey"></div>
         <div class="clear">
             <div class="fix">               
             </div>             
         </div>
     </div><!-- end orangerow -->
          
     <div id="greenrow">
         <%@include file="./subpage/navGreen.jsp" %>            		  		                     
         <div class="clear"></div>
     </div><!-- end greenrow -->
      
      <%@include file="./subpage/footer.jsp" %>     
  </div><!-- end wrapper -->
</body>
</html>
